package com.vpen.picupload.controller;

import com.vpen.picupload.entity.PicUpload;
import com.vpen.picupload.service.PicUploadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * (PicUpload)表控制层
 *
 * @author vpen
 * @since 2021-07-31 23:11:10
 */
@RestController
@RequestMapping("picUpload")
@Api(tags = "用户操作")
@AllArgsConstructor(onConstructor_ = @Autowired)
public class PicUploadController {
    /**
     * 服务对象
     */
    private final PicUploadService picUploadService;

    @PostMapping("/")
    @ApiOperation("图片上传")
    public String uploadImg(@RequestParam("pic") MultipartFile file,HttpServletRequest request){
        picUploadService.upLoad(file,new PicUpload(),request);
        return null;
    }

}